/*
 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/******************************************************************************
 * @file     zx29_rtc.h
 * @brief    header file for rtc driver
 * @version  V1.0
 * @date     01. November 2017
 ******************************************************************************/

#ifndef _ZX29_RTC_H_
#define _ZX29_RTC_H_

/****************************************************************************
* 	                        Include files
****************************************************************************/
#include <soc.h>

/*******************************************************************************
 *                             Type definitions                                *
 ******************************************************************************/
enum e_model_12_24 {
    MODEL_24  = 0x0,    /* 0:24h model */
    MODEL_12  = 0x1,    /* 1:12h model */
};

enum e_am_pm {
    MODEL_AM  = 0x0,    /* 0:AM */
    MODEL_PM  = 0x1,    /* 1:PM */
};

/*******************************************************************************
 *                             Macro definitions                               *
 ******************************************************************************/
#define SI_RTC_BASE			ZX29_RTC_BASE
#define SI_CLK_REG_RTC		(SBY_CRPM_BASEADDR+0x1c)
#define SI_CLK_BIT_EN_SHIFT	(1)

/* RTC reg bit */

/* Version*/
/* Version */
#define RTC_VERS_VERSION		RTC_VERS_VERSION
#define RTC_VERS_VERSION_SHIFT	(16)
#define RTC_VERS_VERSION_MASK	(BIT_MASK(16) << RTC_VERS_VERSION_SHIFT)

/*SECOND*/
/*SECOND*/
#define RTC_SEC					RTC_SEC
#define RTC_SEC_SHIFT			(0)
#define RTC_SEC_MASK			(BIT_MASK(7) << RTC_SEC_SHIFT)

/* SEC_0 ONES, RW */
#define RTC_SEC_0				RTC_SEC_0
#define RTC_SEC_0_SHIFT			(0)
#define RTC_SEC_0_MASK			(BIT_MASK(4) << RTC_SEC_0_SHIFT)

/* SEC_1 TENS, RW */
#define RTC_SEC_1				RTC_SEC_1
#define RTC_SEC_1_SHIFT			(4)
#define RTC_SEC_1_MASK			(BIT_MASK(3) << RTC_SEC_1_SHIFT)

/* MIN*/
/* MINUTE*/
#define RTC_MIN					RTC_MIN
#define RTC_MIN_SHIFT			(0)
#define RTC_MIN_MASK			(BIT_MASK(7) << RTC_MIN_SHIFT)

/* RTC_MIN_0 ONES, RW */
#define RTC_MIN_0				RTC_MIN_0
#define RTC_MIN_0_SHIFT			(0)
#define RTC_MIN_0_MASK			(BIT_MASK(4) << RTC_MIN_0_SHIFT)

/* MIN_1 TENS, RW */
#define RTC_MIN_1				RTC_MIN_1
#define RTC_MIN_1_SHIFT			(4)
#define RTC_MIN_1_MASK			(BIT_MASK(3) << RTC_MIN_1_SHIFT)

/* HOUR */
/* HOUR*/
#define RTC_HOUR				RTC_HOUR
#define RTC_HOUR_SHIFT			(0)
#define RTC_HOUR_MASK			(BIT_MASK(7) << RTC_HOUR_SHIFT)

/* HOUR_0 ONES,  RW */
#define RTC_HOUR_0				RTC_HOUR_0
#define RTC_HOUR_0_SHIFT		(0)
#define RTC_HOUR_0_MASK			(BIT_MASK(4) << RTC_HOUR_0_SHIFT)

/* HOUR_1 TENS,  RW */
#define RTC_HOUR_1				RTC_HOUR_1
#define RTC_HOUR_1_SHIFT		(4)
#define RTC_HOUR_1_MASK			(BIT_MASK(2) << RTC_HOUR_1_SHIFT)

/* AM_PM ,  RW */
#define RTC_HOUR_AM_PM			RTC_HOUR_AM_PM
#define RTC_HOUR_AM_PM_SHIFT	(7)
#define RTC_HOUR_AM_PM_MASK		(BIT_MASK(1) << RTC_HOUR_AM_PM_SHIFT)

/* DAY */
/* DAY*/
#define RTC_DAY					RTC_DAY
#define RTC_DAY_SHIFT			(0)
#define RTC_DAY_MASK			(BIT_MASK(6) << RTC_DAY_SHIFT)

/* DAY_0 ONES,  RW */
#define RTC_DAY_0				RTC_DAY_0
#define RTC_DAY_0_SHIFT			(0)
#define RTC_DAY_0_MASK			(BIT_MASK(4) << RTC_DAY_0_SHIFT)

/* DAY_1 TENS,  RW */
#define RTC_DAY_1				RTC_DAY_1
#define RTC_DAY_1_SHIFT			(4)
#define RTC_DAY_1_MASK			(BIT_MASK(2) << RTC_DAY_1_SHIFT)

/* MONTH */
/* MONTH*/
#define RTC_MONTH				RTC_MONTH
#define RTC_MONTH_SHIFT			(0)
#define RTC_MONTH_MASK			(BIT_MASK(5) << RTC_MONTH_SHIFT)

/* MONTH_0 ONES,  RW */
#define RTC_MONTH_0				RTC_MONTH_0
#define RTC_MONTH_0_SHIFT		(0)
#define RTC_MONTH_0_MASK		(BIT_MASK(4) << RTC_MONTH_0_SHIFT)

/* MONTH_1 TENS,  RW */
#define RTC_MONTH_1				RTC_MONTH_1
#define RTC_MONTH_1_SHIFT		(4)
#define RTC_MONTH_1_MASK		(BIT_MASK(1) << RTC_MONTH_1_SHIFT)

/* YEAR */
/* YEAR*/
#define RTC_YEAR				RTC_YEAR
#define RTC_YEAR_SHIFT			(0)
#define RTC_YEAR_MASK			(BIT_MASK(16) << RTC_YEAR_SHIFT)

/* YEAR_0 ONES,  RW */
#define RTC_YEAR_0				RTC_YEAR_0
#define RTC_YEAR_0_SHIFT		(0)
#define RTC_YEAR_0_MASK			(BIT_MASK(4) << RTC_YEAR_0_SHIFT)

/* YEAR_1 TENS,  RW */
#define RTC_YEAR_1				RTC_YEAR_1
#define RTC_YEAR_1_SHIFT		(4)
#define RTC_YEAR_1_MASK			(BIT_MASK(4) << RTC_YEAR_1_SHIFT)

/* YEAR_2 HUNDREDS,  RW */
#define RTC_YEAR_2				RTC_YEAR_2
#define RTC_YEAR_2_SHIFT		(8)
#define RTC_YEAR_2_MASK			(BIT_MASK(4) << RTC_YEAR_2_SHIFT)

/* YEAR_3 THOUSANDS,  RW */
#define RTC_YEAR_3				RTC_YEAR_3
#define RTC_YEAR_3_SHIFT		(12)
#define RTC_YEAR_3_MASK			(BIT_MASK(4) << RTC_YEAR_3_SHIFT)

/* WEEK  */
/* WEEK ,  RW */
#define RTC_WEEK				RTC_WEEK
#define RTC_WEEK_SHIFT			(0)
#define RTC_WEEK_MASK			(BIT_MASK(3) << RTC_WEEK_SHIFT)

/* ALARMSECOND */
/* ALARMSECOND*/
#define RTC_ALARMSEC			RTC_ALARMSEC
#define RTC_ALARMSEC_SHIFT		(0)
#define RTC_ALARMSEC_MASK		(BIT_MASK(7) << RTC_ALARMSEC_SHIFT)

/* ALARMSEC_0 ONES,  RW */
#define RTC_ALARMSEC_0			RTC_ALARMSEC_0
#define RTC_ALARMSEC_0_SHIFT	(0)
#define RTC_ALARMSEC_0_MASK		(BIT_MASK(4) << RTC_ALARMSEC_0_SHIFT)

/* ALARMSEC_1 TENS,  RW */
#define RTC_ALARMSEC_1			RTC_ALARMSEC_1
#define RTC_ALARMSEC_1_SHIFT	(4)
#define RTC_ALARMSEC_1_MASK		(BIT_MASK(3) << RTC_ALARMSEC_1_SHIFT)

/* ALARMMINUTE  */
/* ALARMMINUTE*/
#define RTC_ALARMMIN			RTC_ALARMMIN
#define RTC_ALARMMIN_SHIFT		(0)
#define RTC_ALARMMIN_MASK		(BIT_MASK(7) << RTC_ALARMMIN_SHIFT)

/* ALARMMIN_0 ONES,  RW */
#define RTC_ALARMMIN_0			RTC_ALARMMIN_0
#define RTC_ALARMMIN_0_SHIFT	(0)
#define RTC_ALARMMIN_0_MASK		(BIT_MASK(4) << RTC_ALARMMIN_0_SHIFT)

/* ALARMMIN_1 TENS,  RW */
#define RTC_ALARMMIN_1			RTC_ALARMMIN_1
#define RTC_ALARMMIN_1_SHIFT	(4)
#define RTC_ALARMMIN_1_MASK		(BIT_MASK(3) << RTC_ALARMMIN_1_SHIFT)

/* ALARMHOUR */
/* ALARMHOUR*/
#define RTC_ALARMHOUR			RTC_ALARMHOUR
#define RTC_ALARMHOUR_SHIFT		(0)
#define RTC_ALARMHOUR_MASK		(BIT_MASK(7) << RTC_ALARMHOUR_SHIFT)

/* ALARMHOUR_0 ONES,  RW */
#define RTC_ALARMHOUR_0			RTC_ALARMHOUR_0
#define RTC_ALARMHOUR_0_SHIFT	(0)
#define RTC_ALARMHOUR_0_MASK	(BIT_MASK(4) << RTC_ALARMHOUR_0_SHIFT)

/* ALARMHOUR_1 TENS,  RW */
#define RTC_ALARMHOUR_1			RTC_ALARMHOUR_1
#define RTC_ALARMHOUR_1_SHIFT	(4)
#define RTC_ALARMHOUR_1_MASK	(BIT_MASK(2) << RTC_ALARMHOUR_1_SHIFT)

/* AM_PM ,  RW */
#define RTC_ALARMHOUR_AM_PM			RTC_ALARMHOUR_AM_PM
#define RTC_ALARMHOUR_AM_PM_SHIFT	(6)
#define RTC_ALARMHOUR_AM_PM_MASK	(BIT_MASK(1) << RTC_ALARMHOUR_AM_PM_SHIFT)

/* ALARMDAY */
/* ALARMDAY */
#define RTC_ALARMDAY			RTC_ALARMDAY
#define RTC_ALARMDAY_SHIFT		(0)
#define RTC_ALARMDAY_MASK		(BIT_MASK(6) << RTC_ALARMDAY_SHIFT)

/* ALARMDAY_0 ONES,  RW */
#define RTC_ALARMDAY_0			RTC_ALARMDAY_0
#define RTC_ALARMDAY_0_SHIFT	(0)
#define RTC_ALARMDAY_0_MASK		(BIT_MASK(4) << RTC_ALARMDAY_0_SHIFT)

/* ALARMDAY_1 TENS,  RW */
#define RTC_ALARMDAY_1			RTC_ALARMDAY_1
#define RTC_ALARMDAY_1_SHIFT	(4)
#define RTC_ALARMDAY_1_MASK		(BIT_MASK(2) << RTC_ALARMDAY_1_SHIFT)

/* ALARMMONTH */
/* ALARMMONTH*/
#define RTC_ALARMMONTH			RTC_ALARMMONTH
#define RTC_ALARMMONTH_SHIFT	(0)
#define RTC_ALARMMONTH_MASK		(BIT_MASK(5) << RTC_ALARMMONTH_SHIFT)

/* ALARMMONTH_0 ONES,  RW */
#define RTC_ALARMMONTH_0		RTC_ALARMMONTH_0
#define RTC_ALARMMONTH_0_SHIFT	(0)
#define RTC_ALARMMONTH_0_MASK	(BIT_MASK(4) << RTC_ALARMMONTH_0_SHIFT)

/* ALARMMONTH_1 TENS,  RW */
#define RTC_ALARMMONTH_1		RTC_ALARMMONTH_1
#define RTC_ALARMMONTH_1_SHIFT	(4)
#define RTC_ALARMMONTH_1_MASK	(BIT_MASK(1) << RTC_ALARMMONTH_1_SHIFT)

/* ALARMYEAR */
/* ALARMYEAR */
#define RTC_ALARMYEAR			RTC_ALARMYEAR
#define RTC_ALARMYEAR_SHIFT		(0)
#define RTC_ALARMYEAR_MASK		(BIT_MASK(16) << RTC_ALARMYEAR_SHIFT)

/* ALARMYEAR_0 ONES,  RW */
#define RTC_ALARMYEAR_0			RTC_ALARMYEAR_0
#define RTC_ALARMYEAR_0_SHIFT	(0)
#define RTC_ALARMYEAR_0_MASK	(BIT_MASK(4) << RTC_ALARMYEAR_0_SHIFT)

/* ALARMYEAR_1 TENS,  RW */
#define RTC_ALARMYEAR_1			RTC_ALARMYEAR_1
#define RTC_ALARMYEAR_1_SHIFT	(4)
#define RTC_ALARMYEAR_1_MASK	(BIT_MASK(4) << RTC_ALARMYEAR_1_SHIFT)

/* ALARMYEAR_2 HUNDREDS,  RW */
#define RTC_ALARMYEAR_2			RTC_ALARMYEAR_2
#define RTC_ALARMYEAR_2_SHIFT	(8)
#define RTC_ALARMYEAR_2_MASK	(BIT_MASK(4) << RTC_ALARMYEAR_2_SHIFT)

/* ALARMYEAR_3 THOUSANDS,  RW */
#define RTC_ALARMYEAR_3			RTC_ALARMYEAR_3
#define RTC_ALARMYEAR_3_SHIFT	(12)
#define RTC_ALARMYEAR_3_MASK	(BIT_MASK(4) << RTC_ALARMYEAR_3_SHIFT)

/* CONTROL */
/* CONTROL_STOP ,RW */
#define RTC_CONTROL_STOP		RTC_CONTROL_STOP
#define RTC_CONTROL_STOP_SHIFT	(0)
#define RTC_CONTROL_STOP_MASK	(BIT_MASK(1) << RTC_CONTROL_STOP_SHIFT)

/* CONTROL_ROUND30S ,  RW */
#define RTC_CONTROL_ROUND30S			RTC_CONTROL_ROUND30S
#define RTC_CONTROL_ROUND30S_SHIFT		(1)
#define RTC_CONTROL_ROUND30S_MASK		(BIT_MASK(1) << RTC_CONTROL_ROUND30S_SHIFT)

/* CONTROL_AUTOCOMP , RW */
#define RTC_CONTROL_AUTOCOMP			RTC_CONTROL_AUTOCOMP
#define RTC_CONTROL_AUTOCOMP_SHIFT		(2)
#define RTC_CONTROL_AUTOCOMP_MASK		(BIT_MASK(1) << RTC_CONTROL_AUTOCOMP_SHIFT)

/* CONTROL_MODEL12_24 , RW */
#define RTC_CONTROL_MODEL12_24			RTC_CONTROL_MODEL12_24
#define RTC_CONTROL_MODEL12_24_SHIFT	(3)
#define RTC_CONTROL_MODEL12_24_MASK		(BIT_MASK(1) << RTC_CONTROL_MODEL12_24_SHIFT)

/* SET ALARM ,  RW */
#define RTC_CONTROL_SETALARM			RTC_CONTROL_SETALARM
#define RTC_CONTROL_SETALARM_SHIFT		(4)
#define RTC_CONTROL_SETALARM_MASK		(BIT_MASK(1) << RTC_CONTROL_SETALARM_SHIFT)

/* CONTROL_TESTMODE , RW */
#define RTC_CONTROL_SET32COUNTER		RTC_CONTROL_SET32COUNTER
#define RTC_CONTROL_SET32COUNTER_SHIFT	(5)
#define RTC_CONTROL_SET32COUNTER_MASK	(BIT_MASK(1) << RTC_CONTROL_SET32COUNTER_SHIFT)

/* CONTROL_SOFTRESET ,RW */
#define RTC_CONTROL_SOFTRESET			RTC_CONTROL_SOFTRESET
#define RTC_CONTROL_SOFTRESET_SHIFT		(6)
#define RTC_CONTROL_SOFTRESET_MASK		(BIT_MASK(1) << RTC_CONTROL_SOFTRESET_SHIFT)

/* CONTROL_CLK32KOUTEN , RW */
#define RTC_CONTROL_CLK32KOUTEN			RTC_CONTROL_CLK32KOUTEN
#define RTC_CONTROL_CLK32KOUTEN_SHIFT	(8)
#define RTC_CONTROL_CLK32KOUTEN_MASK	(BIT_MASK(1) << RTC_CONTROL_CLK32KOUTEN_SHIFT)

/* STATUS */
/* STATUS_BUSY updating,  R */
#define RTC_STATUS_BUSY			RTC_STATUS_BUSY
#define RTC_STATUS_BUSY_SHIFT	(0)
#define RTC_STATUS_BUSY_MASK	(BIT_MASK(1) << RTC_STATUS_BUSY_SHIFT)

/* STATUS_RUN ,R */
#define RTC_STATUS_RUN			RTC_STATUS_RUN
#define RTC_STATUS_RUN_SHIFT	(1)
#define RTC_STATUS_RUN_MASK		(BIT_MASK(1) << RTC_STATUS_RUN_SHIFT)

/* STATUS_ALARM ,RW */
#define RTC_STATUS_ALARM		RTC_STATUS_ALARM
#define RTC_STATUS_ALARM_SHIFT	(6)
#define RTC_STATUS_ALARM_MASK	(BIT_MASK(1) << RTC_STATUS_ALARM_SHIFT)

/* STATUS_TIMER ,RW */
#define RTC_STATUS_TIMER		RTC_STATUS_TIMER
#define RTC_STATUS_TIMER_SHIFT	(7)
#define RTC_STATUS_TIMER_MASK	(BIT_MASK(1) << RTC_STATUS_TIMER_SHIFT)

/* STATUS_TIMER , RW */
#define RTC_STATUS_POWERUP				RTC_STATUS_POWERUP
#define RTC_STATUS_POWERUP_SHIFT		(8)
#define RTC_STATUS_POWERUP_MASK			(BIT_MASK(1) << RTC_STATUS_POWERUP_SHIFT)

/* STATUS_TIMSTAP0 , RW */
#define RTC_STATUS_TIMSTAP0				RTC_STATUS_TIMSTAP0
#define RTC_STATUS_TIMSTAP0_SHIFT		(16)
#define RTC_STATUS_TIMSTAP0_MASK		(BIT_MASK(1) << RTC_STATUS_TIMSTAP0_SHIFT)

/* STATUS_TIMSTAP1 , RW */
#define RTC_STATUS_TIMSTAP1				RTC_STATUS_TIMSTAP1
#define RTC_STATUS_TIMSTAP1_SHIFT		(17)
#define RTC_STATUS_TIMSTAP1_MASK		(BIT_MASK(1) << RTC_STATUS_TIMSTAP1_SHIFT)

/* INT */
/* INT_EVERY , RW */
#define RTC_INT_EVERY		        RTC_INT_EVERY
#define RTC_INT_EVERY_SHIFT		(0)
#define RTC_INT_EVERY_MASK		(BIT_MASK(2) << RTC_INT_EVERY_SHIFT)

/* INT_ITTIMER , RW */
#define RTC_INT_ITTIMER			RTC_INT_ITTIMER
#define RTC_INT_ITTIMER_SHIFT	(2)
#define RTC_INT_ITTIMER_MASK	(BIT_MASK(1) << RTC_INT_ITTIMER_SHIFT)

/* INT_ITALARM , RW */
#define RTC_INT_ITALARM			RTC_INT_ITALARM
#define RTC_INT_ITALARM_SHIFT	(3)
#define RTC_INT_ITALARM_MASK	(BIT_MASK(1) << RTC_INT_ITALARM_SHIFT)

/* INT_TIMSTAP0 , RW */
#define RTC_INT_TIMSTAP0		RTC_INT_TIMSTAP0
#define RTC_INT_TIMSTAP0_SHIFT	(4)
#define RTC_INT_TIMSTAP0_MASK	(BIT_MASK(1) << RTC_INT_TIMSTAP0_SHIFT)

/* INT_TIMSTAP1 , RW */
#define RTC_INT_TIMSTAP1		RTC_INT_TIMSTAP1
#define RTC_INT_TIMSTAP1_SHIFT	(5)
#define RTC_INT_TIMSTAP1_MASK	(BIT_MASK(1) << RTC_INT_TIMSTAP1_SHIFT)

/* COMP */
/* COMP ,RW */
#define RTC_COMP				RTC_COMP
#define RTC_COMP_SHIFT			(0)
#define RTC_COMP_MASK			(BIT_MASK(16) << RTC_COMP_SHIFT)

/* CONFID */
/* CONFID , RW */
#define RTC_CONFID 				RTC_CONFID
#define RTC_CONFID_SHIFT		(0)
#define RTC_CONFID_MASK			(BIT_MASK(16) << RTC_CONFID_SHIFT)

/* POWERINIT1 */
/* POWERINIT1 , RW */
#define RTC_POWERINIT1			RTC_POWERINIT1
#define RTC_POWERINIT1_SHIFT	(0)
#define RTC_POWERINIT1_MASK		(BIT_MASK(16) << RTC_POWERINIT1_SHIFT)

/* POWERINIT2 */
/* POWERINIT2, RW */
#define RTC_POWERINIT2			RTC_POWERINIT2
#define RTC_POWERINIT2_SHIFT	(0)
#define RTC_POWERINIT2_MASK		(BIT_MASK(16) << RTC_POWERINIT2_SHIFT)

/* GET_TIME PARAMETER REG */
/* THE SWITCH OF READ TIME, W */
#define RTC_GET_TIME			RTC_GET_TIME
#define RTC_GET_TIME_SHIFT		(0)
#define RTC_GET_TIME_MASK		(BIT_MASK(31) << RTC_CONFID_SHIFT)


/* STAMP REG BIT DEFINE*/
/* TIMSTAP0_SEL, RW */
#define STAMP_CONTROL_TIMSTAP0_SEL			STAMP_CONTROL_TIMSTAP0_SEL
#define STAMP_CONTROL_TIMSTAP0_SEL_SHIFT	(0)
#define STAMP_CONTROL_TIMSTAP0_SEL_MASK		(BIT_MASK(3) << STAMP_CONTROL_TIMSTAP0_SEL_SHIFT)

/* TIMSTAP0_EN, RW */
#define STAMP_CONTROL_TIMSTAP0_EN			STAMP_CONTROL_TIMSTAP0_EN
#define STAMP_CONTROL_TIMSTAP0_EN_SHIFT		(3)
#define STAMP_CONTROL_TIMSTAP0_EN_MASK		(BIT_MASK(1) << STAMP_CONTROL_TIMSTAP0_EN_SHIFT)

/* TIMSTAP0_POL, RW */
#define STAMP_CONTROL_TIMSTAP0_POL			STAMP_CONTROL_TIMSTAP0_POL
#define STAMP_CONTROL_TIMSTAP0_POL_SHIFT	(4)
#define STAMP_CONTROL_TIMSTAP0_POL_MASK		(BIT_MASK(2) << STAMP_CONTROL_TIMSTAP0_POL_SHIFT)

/* TIMSTAP1_SEL, RW */
#define STAMP_CONTROL_TIMSTAP1_SEL			STAMP_CONTROL_TIMSTAP1_SEL
#define STAMP_CONTROL_TIMSTAP1_SEL_SHIFT	(16)
#define STAMP_CONTROL_TIMSTAP1_SEL_MASK		(BIT_MASK(3) << STAMP_CONTROL_TIMSTAP1_SEL_SHIFT)

/* TIMSTAP1_EN, RW */
#define STAMP_CONTROL_TIMSTAP1_EN			STAMP_CONTROL_TIMSTAP1_EN
#define STAMP_CONTROL_TIMSTAP1_EN_SHIFT		(19)
#define STAMP_CONTROL_TIMSTAP1_EN_MASK		(BIT_MASK(1) << STAMP_CONTROL_TIMSTAP1_EN_SHIFT)

/* TIMSTAP1_POL, RW */
#define STAMP_CONTROL_TIMSTAP1_POL		        STAMP_CONTROL_TIMSTAP0_POL
#define STAMP_CONTROL_TIMSTAP1_POL_SHIFT	(20)
#define STAMP_CONTROL_TIMSTAP1_POL_MASK		(BIT_MASK(2) << STAMP_CONTROL_TIMSTAP1_POL_SHIFT)

/* TIMSTAP0_TIME_POS*/
/* TIMSTAP0_TIME_POS_SEC, R */
#define TIMSTAP0_TIME_POS_SEC			TIMSTAP0_TIME_POS_SEC
#define TIMSTAP0_TIME_POS_SEC_SHIFT		(0)
#define TIMSTAP0_TIME_POS_SEC_MASK		(BIT_MASK(7) << TIMSTAP0_TIME_POS_SEC_SHIFT)

/* TIMSTAP0_TIME_POS_SEC0, R */
#define TIMSTAP0_TIME_POS_SEC0			TIMSTAP0_TIME_POS_SEC0
#define TIMSTAP0_TIME_POS_SEC0_SHIFT	(0)
#define TIMSTAP0_TIME_POS_SEC0_MASK		(BIT_MASK(4) << TIMSTAP0_TIME_POS_SEC0_SHIFT)

/* TIMSTAP0_TIME_POS_SEC1, R */
#define TIMSTAP0_TIME_POS_SEC1			TIMSTAP0_TIME_POS_SEC1
#define TIMSTAP0_TIME_POS_SEC1_SHIFT	(4)
#define TIMSTAP0_TIME_POS_SEC1_MASK		(BIT_MASK(3) << TIMSTAP0_TIME_POS_SEC1_SHIFT)

/* TIMSTAP0_TIME_POS_MIN, R */
#define TIMSTAP0_TIME_POS_MIN			TIMSTAP0_TIME_POS_MIN
#define TIMSTAP0_TIME_POS_MIN_SHIFT		(8)
#define TIMSTAP0_TIME_POS_MIN_MASK		(BIT_MASK(7) << TIMSTAP0_TIME_POS_MIN_SHIFT)

/* TIMSTAP0_TIME_POS_MIN0, R */
#define TIMSTAP0_TIME_POS_MIN0			TIMSTAP0_TIME_POS_MIN0
#define TIMSTAP0_TIME_POS_MIN0_SHIFT	(8)
#define TIMSTAP0_TIME_POS_MIN0_MASK		(BIT_MASK(4) << TIMSTAP0_TIME_POS_MIN0_SHIFT)

/* TIMSTAP0_TIME_POS_MIN1, R */
#define TIMSTAP0_TIME_POS_MIN1			TIMSTAP0_TIME_POS_MIN1
#define TIMSTAP0_TIME_POS_MIN1_SHIFT	(12)
#define TIMSTAP0_TIME_POS_MIN1_MASK		(BIT_MASK(3) << TIMSTAP0_TIME_POS_MIN1_SHIFT)

/* TIMSTAP0_TIME_POS_HOUR, R */
#define TIMSTAP0_TIME_POS_HOUR			TIMSTAP0_TIME_POS_HOUR
#define TIMSTAP0_TIME_POS_HOUR_SHIFT	(16)
#define TIMSTAP0_TIME_POS_HOUR_MASK		(BIT_MASK(6) << TIMSTAP0_TIME_POS_HOUR_SHIFT)

/* TIMSTAP0_TIME_POS_HOUR0, R */
#define TIMSTAP0_TIME_POS_HOUR0			TIMSTAP0_TIME_POS_HOUR0
#define TIMSTAP0_TIME_POS_HOUR0_SHIFT	(16)
#define TIMSTAP0_TIME_POS_HOUR0_MASK	(BIT_MASK(4) << TIMSTAP0_TIME_POS_HOUR0_SHIFT)

/* TIMSTAP0_TIME_POS_HOUR1, R */
#define TIMSTAP0_TIME_POS_HOUR1			TIMSTAP0_TIME_POS_HOUR1
#define TIMSTAP0_TIME_POS_HOUR1_SHIFT	(20)
#define TIMSTAP0_TIME_POS_HOUR1_MASK	(BIT_MASK(2) << TIMSTAP0_TIME_POS_HOUR1_SHIFT)

/* TIMSTAP0_TIME_POS_PMAM,  R */
#define TIMSTAP0_TIME_POS_PMAM			TIMSTAP0_TIME_POS_PMAM
#define TIMSTAP0_TIME_POS_PMAM_SHIFT	(23)
#define TIMSTAP0_TIME_POS_PMAM_MASK		(BIT_MASK(1) << TIMSTAP0_TIME_POS_PMAM_SHIFT)


/* TIMSTAP0_DAY_POS*/
/* TIMSTAP0_DAY_POS_WEEK, R */
#define TIMSTAP0_DAY_POS_WEEK			TIMSTAP0_DAY_POS_WEEK
#define TIMSTAP0_DAY_POS_WEEK_SHIFT		(0)
#define TIMSTAP0_DAY_POS_WEEK_MASK		(BIT_MASK(3) << TIMSTAP0_DAY_POS_WEEK_SHIFT)

/* TIMSTAP0_DAY_POS_DAY, R */
#define TIMSTAP0_DAY_POS_DAY			TIMSTAP0_DAY_POS_DAY
#define TIMSTAP0_DAY_POS_DAY_SHIFT		(3)
#define TIMSTAP0_DAY_POS_DAY_MASK		(BIT_MASK(6) << TIMSTAP0_DAY_POS_DAY_SHIFT)

/* TIMSTAP0_DAY_POS_DAY0, R */
#define TIMSTAP0_DAY_POS_DAY0			TIMSTAP0_DAY_POS_DAY0
#define TIMSTAP0_DAY_POS_DAY0_SHIFT		(3)
#define TIMSTAP0_DAY_POS_DAY0_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_POS_DAY0_SHIFT)

/* TIMSTAP0_DAY_POS_DAY1, R */
#define TIMSTAP0_DAY_POS_DAY1			TIMSTAP0_DAY_POS_DAY1
#define TIMSTAP0_DAY_POS_DAY1_SHIFT		(7)
#define TIMSTAP0_DAY_POS_DAY1_MASK		(BIT_MASK(2) << TIMSTAP0_DAY_POS_DAY1_SHIFT)

/* TIMSTAP0_DAY_POS_MONTH, R */
#define TIMSTAP0_DAY_POS_MONTH			TIMSTAP0_DAY_POS_MONTH
#define TIMSTAP0_DAY_POS_MONTH_SHIFT	(9)
#define TIMSTAP0_DAY_POS_MONTH_MASK		(BIT_MASK(5) << TIMSTAP0_DAY_POS_MONTH_SHIFT)

/* TIMSTAP0_DAY_POS_MONTH0, R */
#define TIMSTAP0_DAY_POS_MONTH0			TIMSTAP0_DAY_POS_MONTH0
#define TIMSTAP0_DAY_POS_MONTH0_SHIFT	(9)
#define TIMSTAP0_DAY_POS_MONTH0_MASK	(BIT_MASK(4) << TIMSTAP0_DAY_POS_MONTH0_SHIFT)

/* TIMSTAP0_DAY_POS_MONTH1, R */
#define TIMSTAP0_DAY_POS_MONTH1			TIMSTAP0_DAY_POS_MONTH1
#define TIMSTAP0_DAY_POS_MONTH1_SHIFT	(13)
#define TIMSTAP0_DAY_POS_MONTH1_MASK	(BIT_MASK(1) << TIMSTAP0_DAY_POS_MONTH1_SHIFT)

/* TIMSTAP0_DAY_POS_YEAR, R */
#define TIMSTAP0_DAY_POS_YEAR			TIMSTAP0_DAY_POS_YEAR
#define TIMSTAP0_DAY_POS_YEAR_SHIFT		(16)
#define TIMSTAP0_DAY_POS_YEAR_MASK		(BIT_MASK(16) << TIMSTAP0_DAY_POS_YEAR_SHIFT)

/* TIMSTAP0_DAY_POS_YEAR0, R */
#define TIMSTAP0_DAY_POS_YEAR0			TIMSTAP0_DAY_POS_YEAR0
#define TIMSTAP0_DAY_POS_YEAR0_SHIFT	(16)
#define TIMSTAP0_DAY_POS_YEAR0_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_POS_YEAR0_SHIFT)

/* TIMSTAP0_DAY_POS_YEAR1, R */
#define TIMSTAP0_DAY_POS_YEAR1		        TIMSTAP0_DAY_POS_YEAR1
#define TIMSTAP0_DAY_POS_YEAR1_SHIFT	(20)
#define TIMSTAP0_DAY_POS_YEAR1_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_POS_YEAR1_SHIFT)

/* TIMSTAP0_DAY_POS_YEAR2, R */
#define TIMSTAP0_DAY_POS_YEAR2			TIMSTAP0_DAY_POS_YEAR2
#define TIMSTAP0_DAY_POS_YEAR2_SHIFT	(24)
#define TIMSTAP0_DAY_POS_YEAR2_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_POS_YEAR2_SHIFT)

/* TIMSTAP0_DAY_POS_YEAR3, R */
#define TIMSTAP0_DAY_POS_YEAR3			TIMSTAP0_DAY_POS_YEAR3
#define TIMSTAP0_DAY_POS_YEAR3_SHIFT	(28)
#define TIMSTAP0_DAY_POS_YEAR3_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_POS_YEAR3_SHIFT)

/* TIMSTAP0_TIME_NEG*/
/* TIMSTAP0_TIME_NEG_SEC, R */
#define TIMSTAP0_TIME_NEG_SEC			TIMSTAP0_TIME_NEG_SEC
#define TIMSTAP0_TIME_NEG_SEC_SHIFT		(0)
#define TIMSTAP0_TIME_NEG_SEC_MASK		(BIT_MASK(7) << TIMSTAP0_TIME_NEG_SEC_SHIFT)

/* TIMSTAP0_TIME_NEG_SEC0, R */
#define TIMSTAP0_TIME_NEG_SEC0			TIMSTAP0_TIME_NEG_SEC0
#define TIMSTAP0_TIME_NEG_SEC0_SHIFT	(0)
#define TIMSTAP0_TIME_NEG_SEC0_MASK		(BIT_MASK(4) << TIMSTAP0_TIME_NEG_SEC0_SHIFT)

/* TIMSTAP0_TIME_NEG_SEC1, R */
#define TIMSTAP0_TIME_NEG_SEC1			TIMSTAP0_TIME_NEG_SEC1
#define TIMSTAP0_TIME_NEG_SEC1_SHIFT	(4)
#define TIMSTAP0_TIME_NEG_SEC1_MASK		(BIT_MASK(3) << TIMSTAP0_TIME_NEG_SEC1_SHIFT)

/* TIMSTAP0_TIME_NEG_MIN, R */
#define TIMSTAP0_TIME_NEG_MIN			TIMSTAP0_TIME_NEG_MIN
#define TIMSTAP0_TIME_NEG_MIN_SHIFT		(8)
#define TIMSTAP0_TIME_NEG_MIN_MASK		(BIT_MASK(7) << TIMSTAP0_TIME_NEG_MIN_SHIFT)

/* TIMSTAP0_TIME_NEG_MIN0, R */
#define TIMSTAP0_TIME_NEG_MIN0			TIMSTAP0_TIME_NEG_MIN0
#define TIMSTAP0_TIME_NEG_MIN0_SHIFT	(8)
#define TIMSTAP0_TIME_NEG_MIN0_MASK		(BIT_MASK(4) << TIMSTAP0_TIME_NEG_MIN0_SHIFT)

/* TIMSTAP0_TIME_NEG_MIN1,  R */
#define TIMSTAP0_TIME_NEG_MIN1			TIMSTAP0_TIME_NEG_MIN1
#define TIMSTAP0_TIME_NEG_MIN1_SHIFT	(12)
#define TIMSTAP0_TIME_NEG_MIN1_MASK		(BIT_MASK(3) << TIMSTAP0_TIME_NEG_MIN1_SHIFT)

/* TIMSTAP0_TIME_NEG_HOUR, R */
#define TIMSTAP0_TIME_NEG_HOUR			TIMSTAP0_TIME_NEG_HOUR
#define TIMSTAP0_TIME_NEG_HOUR_SHIFT	(16)
#define TIMSTAP0_TIME_NEG_HOUR_MASK		(BIT_MASK(6) << TIMSTAP0_TIME_NEG_HOUR_SHIFT)

/* TIMSTAP0_TIME_NEG_HOUR0, R */
#define TIMSTAP0_TIME_NEG_HOUR0			TIMSTAP0_TIME_NEG_HOUR0
#define TIMSTAP0_TIME_NEG_HOUR0_SHIFT	(16)
#define TIMSTAP0_TIME_NEG_HOUR0_MASK	(BIT_MASK(4) << TIMSTAP0_TIME_NEG_HOUR0_SHIFT)

/* TIMSTAP0_TIME_NEG_HOUR1, R */
#define TIMSTAP0_TIME_NEG_HOUR1			TIMSTAP0_TIME_NEG_HOUR1
#define TIMSTAP0_TIME_NEG_HOUR1_SHIFT	(20)
#define TIMSTAP0_TIME_NEG_HOUR1_MASK	(BIT_MASK(2) << TIMSTAP0_TIME_NEG_HOUR1_SHIFT)

/* TIMSTAP0_TIME_NEG_PMAM, R */
#define TIMSTAP0_TIME_NEG_PMAM			TIMSTAP0_TIME_NEG_PMAM
#define TIMSTAP0_TIME_NEG_PMAM_SHIFT	(23)
#define TIMSTAP0_TIME_NEG_PMAM_MASK		(BIT_MASK(1) << TIMSTAP0_TIME_NEG_PMAM_SHIFT)

/* TIMSTAP0_DAY_NEG*/
/* TIMSTAP0_DAY_NEG_WEEK, R */
#define TIMSTAP0_DAY_NEG_WEEK			TIMSTAP0_DAY_NEG_WEEK
#define TIMSTAP0_DAY_NEG_WEEK_SHIFT		(0)
#define TIMSTAP0_DAY_NEG_WEEK_MASK		(BIT_MASK(3) << TIMSTAP0_DAY_NEG_WEEK_SHIFT)

/* TIMSTAP0_DAY_NEG_DAY, R */
#define TIMSTAP0_DAY_NEG_DAY			TIMSTAP0_DAY_NEG_DAY
#define TIMSTAP0_DAY_NEG_DAY_SHIFT		(3)
#define TIMSTAP0_DAY_NEG_DAY_MASK		(BIT_MASK(6) << TIMSTAP0_DAY_NEG_DAY_SHIFT)

/* TIMSTAP0_DAY_NEG_DAY0, R */
#define TIMSTAP0_DAY_NEG_DAY0			TIMSTAP0_DAY_NEG_DAY0
#define TIMSTAP0_DAY_NEG_DAY0_SHIFT		(3)
#define TIMSTAP0_DAY_NEG_DAY0_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_NEG_DAY0_SHIFT)

/* TIMSTAP0_DAY_NEG_DAY1, R */
#define TIMSTAP0_DAY_NEG_DAY1			TIMSTAP0_DAY_NEG_DAY1
#define TIMSTAP0_DAY_NEG_DAY1_SHIFT		(7)
#define TIMSTAP0_DAY_NEG_DAY1_MASK		(BIT_MASK(2) << TIMSTAP0_DAY_NEG_DAY1_SHIFT)

/* TIMSTAP0_DAY_NEG_MONTH, R */
#define TIMSTAP0_DAY_NEG_MONTH			TIMSTAP0_DAY_NEG_MONTH
#define TIMSTAP0_DAY_NEG_MONTH_SHIFT	(9)
#define TIMSTAP0_DAY_NEG_MONTH_MASK		(BIT_MASK(5) << TIMSTAP0_DAY_NEG_MONTH_SHIFT)

/* TIMSTAP0_DAY_NEG_MONTH0, R */
#define TIMSTAP0_DAY_NEG_MONTH0			TIMSTAP0_DAY_NEG_MONTH0
#define TIMSTAP0_DAY_NEG_MONTH0_SHIFT	(9)
#define TIMSTAP0_DAY_NEG_MONTH0_MASK	(BIT_MASK(4) << TIMSTAP0_DAY_NEG_MONTH0_SHIFT)

/* TIMSTAP0_DAY_NEG_MONTH1, R */
#define TIMSTAP0_DAY_NEG_MONTH1			TIMSTAP0_DAY_NEG_MONTH1
#define TIMSTAP0_DAY_NEG_MONTH1_SHIFT	(13)
#define TIMSTAP0_DAY_NEG_MONTH1_MASK	(BIT_MASK(1) << TIMSTAP0_DAY_NEG_MONTH1_SHIFT)

/* TIMSTAP0_DAY_NEG_YEAR, R */
#define TIMSTAP0_DAY_NEG_YEAR			TIMSTAP0_DAY_NEG_YEAR
#define TIMSTAP0_DAY_NEG_YEAR_SHIFT		(16)
#define TIMSTAP0_DAY_NEG_YEAR_MASK		(BIT_MASK(16) << TIMSTAP0_DAY_NEG_YEAR_SHIFT)

/* TIMSTAP0_DAY_NEG_YEAR0, R */
#define TIMSTAP0_DAY_NEG_YEAR0			TIMSTAP0_DAY_NEG_YEAR0
#define TIMSTAP0_DAY_NEG_YEAR0_SHIFT	(16)
#define TIMSTAP0_DAY_NEG_YEAR0_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_NEG_YEAR0_SHIFT)

/* TIMSTAP0_DAY_NEG_YEAR1, R */
#define TIMSTAP0_DAY_NEG_YEAR1			TIMSTAP0_DAY_NEG_YEAR1
#define TIMSTAP0_DAY_NEG_YEAR1_SHIFT	(20)
#define TIMSTAP0_DAY_NEG_YEAR1_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_NEG_YEAR1_SHIFT)

/* TIMSTAP0_DAY_NEG_YEAR2, R */
#define TIMSTAP0_DAY_NEG_YEAR2			TIMSTAP0_DAY_NEG_YEAR2
#define TIMSTAP0_DAY_NEG_YEAR2_SHIFT	(24)
#define TIMSTAP0_DAY_NEG_YEAR2_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_NEG_YEAR2_SHIFT)

/* TIMSTAP0_DAY_NEG_YEAR3, R */
#define TIMSTAP0_DAY_NEG_YEAR3			TIMSTAP0_DAY_NEG_YEAR3
#define TIMSTAP0_DAY_NEG_YEAR3_SHIFT	(28)
#define TIMSTAP0_DAY_NEG_YEAR3_MASK		(BIT_MASK(4) << TIMSTAP0_DAY_NEG_YEAR3_SHIFT)


/* TIMSTAP1_TIME_POS*/
/* TIMSTAP1_TIME_POS_SEC, R */
#define TIMSTAP1_TIME_POS_SEC			TIMSTAP1_TIME_POS_SEC
#define TIMSTAP1_TIME_POS_SEC_SHIFT		(0)
#define TIMSTAP1_TIME_POS_SEC_MASK		(BIT_MASK(7) << TIMSTAP1_TIME_POS_SEC_SHIFT)

/* TIMSTAP1_TIME_POS_SEC0, R */
#define TIMSTAP1_TIME_POS_SEC0			TIMSTAP1_TIME_POS_SEC0
#define TIMSTAP1_TIME_POS_SEC0_SHIFT	(0)
#define TIMSTAP1_TIME_POS_SEC0_MASK		(BIT_MASK(4) << TIMSTAP1_TIME_POS_SEC0_SHIFT)

/* TIMSTAP1_TIME_POS_SEC1, R */
#define TIMSTAP1_TIME_POS_SEC1			TIMSTAP1_TIME_POS_SEC1
#define TIMSTAP1_TIME_POS_SEC1_SHIFT	(4)
#define TIMSTAP1_TIME_POS_SEC1_MASK		(BIT_MASK(3) << TIMSTAP1_TIME_POS_SEC1_SHIFT)

/* TIMSTAP1_TIME_POS_MIN, R */
#define TIMSTAP1_TIME_POS_MIN			TIMSTAP1_TIME_POS_MIN
#define TIMSTAP1_TIME_POS_MIN_SHIFT		(8)
#define TIMSTAP1_TIME_POS_MIN_MASK		(BIT_MASK(7) << TIMSTAP1_TIME_POS_MIN_SHIFT)

/* TIMSTAP1_TIME_POS_MIN0, R */
#define TIMSTAP1_TIME_POS_MIN0			TIMSTAP1_TIME_POS_MIN0
#define TIMSTAP1_TIME_POS_MIN0_SHIFT	(8)
#define TIMSTAP1_TIME_POS_MIN0_MASK		(BIT_MASK(4) << TIMSTAP1_TIME_POS_MIN0_SHIFT)

/* TIMSTAP0_TIME_POS_MIN1, R */
#define TIMSTAP1_TIME_POS_MIN1			TIMSTAP1_TIME_POS_MIN1
#define TIMSTAP1_TIME_POS_MIN1_SHIFT	(12)
#define TIMSTAP1_TIME_POS_MIN1_MASK		(BIT_MASK(3) << TIMSTAP1_TIME_POS_MIN1_SHIFT)

/* TIMSTAP1_TIME_POS_HOUR0, R */
#define TIMSTAP1_TIME_POS_HOUR			TIMSTAP1_TIME_POS_HOUR
#define TIMSTAP1_TIME_POS_HOUR_SHIFT	(16)
#define TIMSTAP1_TIME_POS_HOUR_MASK		(BIT_MASK(6) << TIMSTAP1_TIME_POS_HOUR_SHIFT)

/* TIMSTAP1_TIME_POS_HOUR0, R */
#define TIMSTAP1_TIME_POS_HOUR0			TIMSTAP1_TIME_POS_HOUR0
#define TIMSTAP1_TIME_POS_HOUR0_SHIFT	(16)
#define TIMSTAP1_TIME_POS_HOUR0_MASK	(BIT_MASK(4) << TIMSTAP1_TIME_POS_HOUR0_SHIFT)

/* TIMSTAP1_TIME_POS_HOUR1, R */
#define TIMSTAP1_TIME_POS_HOUR1			TIMSTAP1_TIME_POS_HOUR1
#define TIMSTAP1_TIME_POS_HOUR1_SHIFT	(20)
#define TIMSTAP1_TIME_POS_HOUR1_MASK	(BIT_MASK(2) << TIMSTAP1_TIME_POS_HOUR1_SHIFT)

/* TIMSTAP1_TIME_POS_PMAM, R */
#define TIMSTAP1_TIME_POS_PMAM			TIMSTAP1_TIME_POS_PMAM
#define TIMSTAP1_TIME_POS_PMAM_SHIFT	(23)
#define TIMSTAP1_TIME_POS_PMAM_MASK		(BIT_MASK(1) << TIMSTAP1_TIME_POS_PMAM_SHIFT)


/* TIMSTAP1_DAY_POS*/
/* TIMSTAP1_DAY_POS_WEEK, R */
#define TIMSTAP1_DAY_POS_WEEK			TIMSTAP1_DAY_POS_WEEK
#define TIMSTAP1_DAY_POS_WEEK_SHIFT		(0)
#define TIMSTAP1_DAY_POS_WEEK_MASK		(BIT_MASK(3) << TIMSTAP1_DAY_POS_WEEK_SHIFT)

/* TIMSTAP1_DAY_POS_DAY, R */
#define TIMSTAP1_DAY_POS_DAY			TIMSTAP1_DAY_POS_DAY
#define TIMSTAP1_DAY_POS_DAY_SHIFT		(3)
#define TIMSTAP1_DAY_POS_DAY_MASK		(BIT_MASK(6) << TIMSTAP1_DAY_POS_DAY_SHIFT)

/* TIMSTAP1_DAY_POS_DAY0, R */
#define TIMSTAP1_DAY_POS_DAY0			TIMSTAP1_DAY_POS_DAY0
#define TIMSTAP1_DAY_POS_DAY0_SHIFT		(3)
#define TIMSTAP1_DAY_POS_DAY0_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_POS_DAY0_SHIFT)

/* TIMSTAP1_DAY_POS_DAY1, R */
#define TIMSTAP1_DAY_POS_DAY1			TIMSTAP1_DAY_POS_DAY1
#define TIMSTAP1_DAY_POS_DAY1_SHIFT		(7)
#define TIMSTAP1_DAY_POS_DAY1_MASK		(BIT_MASK(2) << TIMSTAP1_DAY_POS_DAY1_SHIFT)

/* TIMSTAP1_DAY_POS_MONTH, R */
#define TIMSTAP1_DAY_POS_MONTH			TIMSTAP1_DAY_POS_MONTH
#define TIMSTAP1_DAY_POS_MONTH_SHIFT	(9)
#define TIMSTAP1_DAY_POS_MONTH_MASK		(BIT_MASK(5) << TIMSTAP1_DAY_POS_MONTH_SHIFT)

/* TIMSTAP1_DAY_POS_MONTH0, R */
#define TIMSTAP1_DAY_POS_MONTH0			TIMSTAP1_DAY_POS_MONTH0
#define TIMSTAP1_DAY_POS_MONTH0_SHIFT	(9)
#define TIMSTAP1_DAY_POS_MONTH0_MASK	(BIT_MASK(4) << TIMSTAP1_DAY_POS_MONTH0_SHIFT)

/* TIMSTAP1_DAY_POS_MONTH1, R */
#define TIMSTAP1_DAY_POS_MONTH1			TIMSTAP1_DAY_POS_MONTH1
#define TIMSTAP1_DAY_POS_MONTH1_SHIFT	(13)
#define TIMSTAP1_DAY_POS_MONTH1_MASK	(BIT_MASK(1) << TIMSTAP1_DAY_POS_MONTH1_SHIFT)

/* TIMSTAP1_DAY_POS_YEAR, R */
#define TIMSTAP1_DAY_POS_YEAR			TIMSTAP1_DAY_POS_YEAR
#define TIMSTAP1_DAY_POS_YEAR_SHIFT		(16)
#define TIMSTAP1_DAY_POS_YEAR_MASK		(BIT_MASK(16) << TIMSTAP1_DAY_POS_YEAR_SHIFT)

/* TIMSTAP1_DAY_POS_YEAR0, R */
#define TIMSTAP1_DAY_POS_YEAR0			TIMSTAP1_DAY_POS_YEAR0
#define TIMSTAP1_DAY_POS_YEAR0_SHIFT	(16)
#define TIMSTAP1_DAY_POS_YEAR0_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_POS_YEAR0_SHIFT)

/* TIMSTAP1_DAY_POS_YEAR1, R */
#define TIMSTAP1_DAY_POS_YEAR1			TIMSTAP1_DAY_POS_YEAR1
#define TIMSTAP1_DAY_POS_YEAR1_SHIFT	(20)
#define TIMSTAP1_DAY_POS_YEAR1_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_POS_YEAR1_SHIFT)

/* TIMSTAP1_DAY_POS_YEAR2, R */
#define TIMSTAP1_DAY_POS_YEAR2			TIMSTAP1_DAY_POS_YEAR2
#define TIMSTAP1_DAY_POS_YEAR2_SHIFT	(24)
#define TIMSTAP1_DAY_POS_YEAR2_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_POS_YEAR2_SHIFT)

/* TIMSTAP1_DAY_POS_YEAR3, R */
#define TIMSTAP1_DAY_POS_YEAR3			TIMSTAP1_DAY_POS_YEAR3
#define TIMSTAP1_DAY_POS_YEAR3_SHIFT	(28)
#define TIMSTAP1_DAY_POS_YEAR3_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_POS_YEAR3_SHIFT)

/* TIMSTAP1_TIME_NEG*/
/* TIMSTAP1_TIME_NEG_SEC, R */
#define TIMSTAP1_TIME_NEG_SEC			TIMSTAP1_TIME_NEG_SEC
#define TIMSTAP1_TIME_NEG_SEC_SHIFT		(0)
#define TIMSTAP1_TIME_NEG_SEC_MASK		(BIT_MASK(7) << TIMSTAP1_TIME_NEG_SEC_SHIFT)

/* TIMSTAP1_TIME_NEG_SEC0, R */
#define TIMSTAP1_TIME_NEG_SEC0			TIMSTAP1_TIME_NEG_SEC0
#define TIMSTAP1_TIME_NEG_SEC0_SHIFT	(0)
#define TIMSTAP1_TIME_NEG_SEC0_MASK		(BIT_MASK(4) << TIMSTAP1_TIME_NEG_SEC0_SHIFT)

/* TIMSTAP1_TIME_NEG_SEC1, R */
#define TIMSTAP1_TIME_NEG_SEC1			TIMSTAP1_TIME_NEG_SEC1
#define TIMSTAP1_TIME_NEG_SEC1_SHIFT	(4)
#define TIMSTAP1_TIME_NEG_SEC1_MASK		(BIT_MASK(3) << TIMSTAP0_TIME_NEG_SEC1_SHIFT)

/* TIMSTAP1_TIME_NEG_MIN, R */
#define TIMSTAP1_TIME_NEG_MIN			TIMSTAP1_TIME_NEG_MIN
#define TIMSTAP1_TIME_NEG_MIN_SHIFT		(8)
#define TIMSTAP1_TIME_NEG_MIN_MASK		(BIT_MASK(7) << TIMSTAP1_TIME_NEG_MIN_SHIFT)

/* TIMSTAP1_TIME_NEG_MIN0, R */
#define TIMSTAP1_TIME_NEG_MIN0			TIMSTAP1_TIME_NEG_MIN0
#define TIMSTAP1_TIME_NEG_MIN0_SHIFT	(8)
#define TIMSTAP1_TIME_NEG_MIN0_MASK		(BIT_MASK(4) << TIMSTAP1_TIME_NEG_MIN0_SHIFT)

/* TIMSTAP1_TIME_NEG_MIN1, R */
#define TIMSTAP1_TIME_NEG_MIN1			TIMSTAP1_TIME_NEG_MIN1
#define TIMSTAP1_TIME_NEG_MIN1_SHIFT	(12)
#define TIMSTAP1_TIME_NEG_MIN1_MASK		(BIT_MASK(3) << TIMSTAP1_TIME_NEG_MIN1_SHIFT)

/* TIMSTAP1_TIME_NEG_HOUR, R */
#define TIMSTAP1_TIME_NEG_HOUR			TIMSTAP1_TIME_NEG_HOUR
#define TIMSTAP1_TIME_NEG_HOUR_SHIFT	(16)
#define TIMSTAP1_TIME_NEG_HOUR_MASK		(BIT_MASK(6) << TIMSTAP1_TIME_NEG_HOUR0_SHIFT)

/* TIMSTAP1_TIME_NEG_HOUR0, R */
#define TIMSTAP1_TIME_NEG_HOUR0			TIMSTAP1_TIME_NEG_HOUR0
#define TIMSTAP1_TIME_NEG_HOUR0_SHIFT	(16)
#define TIMSTAP1_TIME_NEG_HOUR0_MASK	(BIT_MASK(4) << TIMSTAP1_TIME_NEG_HOUR0_SHIFT)

/* TIMSTAP1_TIME_NEG_HOUR1, R */
#define TIMSTAP1_TIME_NEG_HOUR1			TIMSTAP1_TIME_NEG_HOUR1
#define TIMSTAP1_TIME_NEG_HOUR1_SHIFT	(20)
#define TIMSTAP1_TIME_NEG_HOUR1_MASK	(BIT_MASK(2) << TIMSTAP1_TIME_NEG_HOUR1_SHIFT)

/* TIMSTAP1_TIME_NEG_PMAM, R */
#define TIMSTAP1_TIME_NEG_PMAM			TIMSTAP1_TIME_NEG_PMAM
#define TIMSTAP1_TIME_NEG_PMAM_SHIFT	(23)
#define TIMSTAP1_TIME_NEG_PMAM_MASK		(BIT_MASK(1) << TIMSTAP1_TIME_NEG_PMAM_SHIFT)

/* TIMSTAP1_DAY_NEG*/
/* TIMSTAP1_DAY_NEG_WEEK, */
#define TIMSTAP1_DAY_NEG_WEEK			TIMSTAP1_DAY_NEG_WEEK
#define TIMSTAP1_DAY_NEG_WEEK_SHIFT		(0)
#define TIMSTAP1_DAY_NEG_WEEK_MASK		(BIT_MASK(3) << TIMSTAP1_DAY_NEG_WEEK_SHIFT)

/* TIMSTAP1_DAY_NEG_DAY, R */
#define TIMSTAP1_DAY_NEG_DAY			TIMSTAP1_DAY_NEG_DAY
#define TIMSTAP1_DAY_NEG_DAY_SHIFT		(3)
#define TIMSTAP1_DAY_NEG_DAY_MASK		(BIT_MASK(6) << TIMSTAP1_DAY_NEG_DAY_SHIFT)

/* TIMSTAP1_DAY_NEG_DAY0, R */
#define TIMSTAP1_DAY_NEG_DAY0			TIMSTAP1_DAY_NEG_DAY0
#define TIMSTAP1_DAY_NEG_DAY0_SHIFT		(3)
#define TIMSTAP1_DAY_NEG_DAY0_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_NEG_DAY0_SHIFT)

/* TIMSTAP1_DAY_NEG_DAY1, R */
#define TIMSTAP1_DAY_NEG_DAY1			TIMSTAP1_DAY_NEG_DAY1
#define TIMSTAP1_DAY_NEG_DAY1_SHIFT		(7)
#define TIMSTAP1_DAY_NEG_DAY1_MASK		(BIT_MASK(2) << TIMSTAP1_DAY_NEG_DAY1_SHIFT)

/* TIMSTAP1_DAY_NEG_MONTH, R */
#define TIMSTAP1_DAY_NEG_MONTH			TIMSTAP1_DAY_NEG_MONTH
#define TIMSTAP1_DAY_NEG_MONTH_SHIFT	(9)
#define TIMSTAP1_DAY_NEG_MONTH_MASK		(BIT_MASK(5) << TIMSTAP1_DAY_NEG_MONTH_SHIFT)

/* TIMSTAP1_DAY_NEG_MONTH0, R */
#define TIMSTAP1_DAY_NEG_MONTH0			TIMSTAP1_DAY_NEG_MONTH0
#define TIMSTAP1_DAY_NEG_MONTH0_SHIFT	(9)
#define TIMSTAP1_DAY_NEG_MONTH0_MASK	(BIT_MASK(4) << TIMSTAP1_DAY_NEG_MONTH0_SHIFT)

/* TIMSTAP1_DAY_NEG_MONTH1, R */
#define TIMSTAP1_DAY_NEG_MONTH1			TIMSTAP1_DAY_NEG_MONTH1
#define TIMSTAP1_DAY_NEG_MONTH1_SHIFT	(13)
#define TIMSTAP1_DAY_NEG_MONTH1_MASK	(BIT_MASK(1) << TIMSTAP1_DAY_NEG_MONTH1_SHIFT)

/* TIMSTAP1_DAY_NEG_YEAR,  R */
#define TIMSTAP1_DAY_NEG_YEAR			TIMSTAP1_DAY_NEG_YEAR
#define TIMSTAP1_DAY_NEG_YEAR_SHIFT		(16)
#define TIMSTAP1_DAY_NEG_YEAR_MASK		(BIT_MASK(16) << TIMSTAP1_DAY_NEG_YEAR_SHIFT)

/* TIMSTAP1_DAY_NEG_YEAR0, R */
#define TIMSTAP1_DAY_NEG_YEAR0			TIMSTAP1_DAY_NEG_YEAR0
#define TIMSTAP1_DAY_NEG_YEAR0_SHIFT	(16)
#define TIMSTAP1_DAY_NEG_YEAR0_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_NEG_YEAR0_SHIFT)

/* TIMSTAP1_DAY_NEG_YEAR1, R */
#define TIMSTAP1_DAY_NEG_YEAR1			TIMSTAP1_DAY_NEG_YEAR1
#define TIMSTAP1_DAY_NEG_YEAR1_SHIFT	(20)
#define TIMSTAP1_DAY_NEG_YEAR1_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_NEG_YEAR1_SHIFT)

/* TIMSTAP1_DAY_NEG_YEAR2, R */
#define TIMSTAP1_DAY_NEG_YEAR2			TIMSTAP1_DAY_NEG_YEAR2
#define TIMSTAP1_DAY_NEG_YEAR2_SHIFT	(24)
#define TIMSTAP1_DAY_NEG_YEAR2_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_NEG_YEAR2_SHIFT)

/* TIMSTAP1_DAY_NEG_YEAR3, R */
#define TIMSTAP1_DAY_NEG_YEAR3			TIMSTAP1_DAY_NEG_YEAR3
#define TIMSTAP1_DAY_NEG_YEAR3_SHIFT	(28)
#define TIMSTAP1_DAY_NEG_YEAR3_MASK		(BIT_MASK(4) << TIMSTAP1_DAY_NEG_YEAR3_SHIFT)

/*******************************************************************************
 *                             Type definitions                                *
 ******************************************************************************/
/** regs of RTC  */
typedef struct {
	uint32_t vers;                             /**< offset:0x00    R      */
	uint32_t sec;                              /**< offset:0x04    RW     */
	uint32_t min;                              /**< offset:0x08    RW     */
	uint32_t hour;                             /**< offset:0x0c    RW     */
	uint32_t day;                              /**< offset:0x10    RW     */
	uint32_t month;                            /**< offset:0x14    RW     */
	uint32_t year;                             /**< offset:0x18    RW     */
	uint32_t week;                             /**< offset:0x1c    RW     */
	uint32_t alarm_sec;                        /**< offset:0x20    RW     */
	uint32_t alarm_min;                        /**< offset:0x24    RW     */
	uint32_t alarm_hour;                       /**< offset:0x28    RW     */
	uint32_t alarm_day;                        /**< offset:0x2c    RW     */
	uint32_t alarm_month;                      /**< offset:0x30    RW     */
	uint32_t alarm_year;                       /**< offset:0x34    RW     */
	uint32_t rtc_control;                      /**< offset:0x38    RW     */
	uint32_t rtc_status;                       /**< offset:0x3c    R      */
	uint32_t rtc_int;                          /**< offset:0x40    RW     */
	uint32_t rtc_comp;                         /**< offset:0x44    RW     */
	uint32_t conf_id;                          /**< offset:0x48    RW     */
	uint32_t power_init1;                      /**< offset:0x4c    RW     */
	uint32_t power_init2;                      /**< offset:0x50    RW     */
	uint32_t rtc_get_time;                     /**< offset:0x54    RW     */
	uint32_t reserved;	 		   /**< offset:0x58    RW     */
	uint32_t stap_control; 			   /**< offset:0x5c    RW     */
	uint32_t stap0_time_pos;                   /**< offset:0x60    RW     */
	uint32_t stap0_day_pos;                    /**< offset:0x64    RW     */
	uint32_t stap0_time_neg;                   /**< offset:0x68    RW     */
	uint32_t stap0_day_neg;                    /**< offset:0x6c    RW     */
	uint32_t stap1_time_pos;                   /**< offset:0x70    RW     */
	uint32_t stap1_day_pos;                    /**< offset:0x74    RW     */
	uint32_t stap1_time_neg;                   /**< offset:0x78    RW     */
	uint32_t stap1_day_neg;                    /**< offset:0x7c    RW     */
} zx29_rtc_reg_t;

#endif
